package com.cnebula.uas.sso.model;

import java.math.BigDecimal;
import java.util.Date;

public class Card {

	/****************
	 * 实体属性部分
	 ****************/
	/**
	 * 证卡标识 流水号
	 */
	protected String id;// = IDUtil.getId(Card.class);
	/**
	 * 证卡类型
	 * 
	 */
	protected int type;
	/**
	 * 证卡编码
	 */
	protected String code;
	/**
	 * 证卡状态 无证卡（注销的证卡）、可用的证卡、停用的证卡
	 */
	protected int status = 2;

	protected BigDecimal cash = new BigDecimal(0);

	/**
	 * 证卡生效日期
	 */
	protected Date validDate = new Date();
	/**
	 * 证卡失效日期
	 */
	protected Date invalidDate = new Date(System.currentTimeMillis() + 1000L * 3600 * 24 * 365 * 10);

	/****************
	 * 实体关系部分
	 ****************/
	/**
	 * 所属用户
	 */
	protected UMPrincipal principle;

	protected int version;

	public Card() {
	}

	public int getVersion() {
		return version;
	}

	public void setVersion(int version) {
		this.version = version;
	}

	public String getId() {
		return id;
	}

	public void setId(String id) {
		this.id = id;
	}

	/**
	 * !11 A类读者(参考类借阅权限押金400元)；12 B类读者(普通类借阅权限押金100)； !21
	 * 普通阅览证；31特许VIP证(同11但是不收押金);41公务证(同12但不收押金); !51 馆内职工证；61馆内集体证;71活动奖励证 !81
	 * 少儿借阅证；13电子图书借阅权限 32人文之光
	 * 
	 * @return
	 */

	public int getType() {
		return type;
	}

	public void setType(int type) {
		this.type = type;
	}

	public String getCode() {
		return code;
	}

	public void setCode(String code) {
		this.code = code;
	}

	public int getStatus() {
		return status;
	}

	public void setStatus(int status) {
		this.status = status;
	}

	public UMPrincipal getPrinciple() {
		return principle;
	}

	public void setPrinciple(UMPrincipal principle) {
		this.principle = principle;
	}

	public Date getValidDate() {
		return validDate;
	}

	public void setValidDate(Date validDate) {
		this.validDate = validDate;
	}

	public Date getInvalidDate() {
		return invalidDate;
	}

	public void setInvalidDate(Date invalidDate) {
		this.invalidDate = invalidDate;
	}

	public BigDecimal getCash() {
		return cash;
	}

	public void setCash(BigDecimal cash) {
		this.cash = cash;
	}

	public String toString() {
		StringBuilder sb = new StringBuilder();
		String umid = this.getPrinciple() == null ? "null" : getPrinciple().getId();
		sb.append("[").append("ID:" + this.getId()).append(",").append("Status:" + this.getStatus()).append(",")
				.append("Code:" + this.getCode()).append(",").append("UMPrincipal:" + umid).append(",")
				.append("Type:" + this.getType()).append("]");

		return sb.toString();
	}

}
